package com.atguigu.lease.common.mybatisplus;

import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * ClassName:MybatisMetaObjectHandler
 * Package:IntelliJ IDEA
 * Description:
 *
 * @Author xiaoming
 * @Create 2024-11-08 22:43
 * @Version 1.0
 */
@Component

public class MybatisMetaObjectHandler implements MetaObjectHandler {
    //设置插入时要进行的操作
    @Override
    public void insertFill(MetaObject metaObject) {
        this.strictInsertFill(metaObject, "createTime", Date.class, new Date());
    }

    //设置更新时要进行的操作
    @Override
    public void updateFill(MetaObject metaObject) {
        this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date());
    }
}
